using Daemon.Infrustructure.Contract;
using System;
using System.Collections.Generic;
using System.Data;
using Daemon.Model;
using Daemon.Data.Substructure.Enums;
using Daemon.Model.Entities;

namespace Daemon.Repository.Contract
{
    public interface ILogRepository : IRepository
    {
        List<LogRuleReport> GetLogRuleReports(int ruleId);

        List<LogRule> GetLogRules(Type entityType, EntityChangeType entityChangeType);

        List<LogRuleMonitoringField> GetLogRuleMonitoringFields(int logRuleId);

        List<LogRuleCalculatedField> GetLogRuleCalculatedFields(int ruleId);

        List<LogEntityHardcodedValue> GetLogEntityHardcodedValues(string entityType);

        void SaveLogEntry(LogEntry logEntry);

        void SaveLogEntityEvents(IEnumerable<LogEntityEvent> logEntityEvents);

        void SaveLogEntityEvent(LogEntityEvent logEntityEvent);

        void SaveLogEntityEventTrackedChanges(IEnumerable<LogEntityEventTrackedChange> logEntityEventTrackedChanges);

        LogEntityMeta GetEntityMetaByEntityName(string entityName);

        List<LogEntityFKMeta> GetLogEntityFKMetas(string entityName);

        string GetValueByEntityMetaReferencedInfo(string entityValue, string descriptiveNameField, string pkField, string pkValue);

        string ExecuteCalculationSql(string sql);

        ReportingEntityDto ExecuteReportingSql(string sql);

        string FormatLogEntry<T>(T entity, string logMacro, IEnumerable<TrackedField> trackedFields, IEnumerable<LogRuleCalculatedField> logRuleCalculatedFields, IEnumerable<ConstraintTableInfo> constraintTableInfos, Dictionary<string, string> keyWords);

        string ReplaceTerms<T>(string text, T entity, IEnumerable<TrackedField> trackedFields, IEnumerable<LogRuleCalculatedField> logRuleCalculatedFields, IEnumerable<ConstraintTableInfo> constraintTableInfos, Dictionary<string, string> keyWords);

        List<ConstraintTableInfo> GetReferencedTableInfos(string table);

        string TextValue(object value);
    }
}
